import type { App } from 'vue'

import TippyPopover from '@/components/ding-flow/base/TippyPopover.vue'
import ClearableRadioGroup from '@/components/common/ClearableRadioGroup.vue'
import EditItem from '@/components/common/EditItem.vue'
import ValidateInput from '@/components/common/ValidateInput.vue'
import ValidateRadioGroup from '@/components/common/ValidateRadioGroup.vue'
import ValidateSelect from '@/components/common/ValidateSelect.vue'
import ValidateTagInput from '@/components/common/ValidateTagInput.vue'
import ValidateTextarea from '@/components/common/ValidateTextarea.vue'

import DingFlowList from '@/components/ding-flow/entry/DingFlowList.vue'
import NodeBehavior from '@/components/ding-flow/base/NodeBehavior.vue'

import EventNode from '@/components/ding-flow/nodes/EventNode.vue'
import ExpressionNode from '@/components/ding-flow/nodes/ExpressionNode.vue'
import GatewayNode from '@/components/ding-flow/nodes/GatewayNode.vue'
import ServiceNode from '@/components/ding-flow/nodes/ServiceNode.vue'
import SubprocessNode from '@/components/ding-flow/nodes/SubprocessNode.vue'
import TaskNode from '@/components/ding-flow/nodes/TaskNode.vue'

const components = [
  ClearableRadioGroup,
  EditItem,
  ValidateInput,
  ValidateRadioGroup,
  ValidateSelect,
  ValidateTagInput,
  ValidateTextarea,

  DingFlowList,
  NodeBehavior,
  TippyPopover,
  EventNode,
  ExpressionNode,
  GatewayNode,
  ServiceNode,
  SubprocessNode,
  TaskNode,
]

function install(app: App) {
  components.forEach((component) => {
    app.component(component.name as string, component)
  })
}

export default {
  install,
}
